"use strict";

const Controller = require("egg").Controller;

class BasicController extends Controller {
      success(data) {  
            this.ctx.body = {
                  code: 0,
                  data,
            };
      }

      error(message, errors, code = -1) { 
            this.ctx.body = {
                  code,
                  message,
                  errors,
            };
      }

      message(message) { 
            this.ctx.body = {
                  code: 0,
                  message,
            };
      }
}

module.exports = BasicController;
